<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function sanjiao(num) {
        var i = num;
        var star = "*";
        for (var j = 1; j <= i; j++) {
          var str = "";
          for (var k = 1; k <= j; k++) {
            str += star;
          }
          console.log(str);
        }
      }
      var num = prompt("请输入一个数：") * 1;
      sanjiao(num);
    </script>
  </body>
</html>
